<template>
  <div class="step1">
    <h4>基本信息</h4>
    <div class="form">
      <el-form :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm">
        <el-form-item label="患者姓名：" prop="name">
          <el-input v-model.trim="ruleForm.name" style="width:180px" placeholder="请输入姓名" :auto-complete="true"></el-input>
        </el-form-item>
        <el-form-item label="患者性别：" prop="name">
          <el-radio-group v-model="ruleForm.sex">
            <el-radio label="男" value="1"></el-radio>
            <el-radio label="女" value="0"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="出生日期：" required>
          <el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1" style="width: 180px;"></el-date-picker>
        </el-form-item>
        <el-form-item label="患者主诉：" prop="desc">
          <el-input type="textarea" v-model="ruleForm.desc"></el-input>
        </el-form-item>
        <!-- <el-form-item>
          <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
          <el-button @click="resetForm('ruleForm')">重置</el-button>
        </el-form-item> -->
      </el-form>
    </div>

    <div class="pics">
      <div class="left_pic">
        <hr style="width:1170px" />
        <h4>面相照</h4>
        <div class="facePics">
          <div class="facePic_item" v-for="i in 4" :key="i">
            <el-upload drag action="https://jsonplaceholder.typicode.com/posts/" :multiple="false">
              <i class="el-icon-upload"></i>
              <div>
                <span style="font-size: 16px ;font-weight: 700;">正面照</span>
              </div>
              <div>点击/拖拽上传文件</div>
              <!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div> -->
            </el-upload>
          </div>
        </div>
        <h4>口内照</h4>
        <div class="mouthPic">
          <div class="mouthPic_item" v-for="i in 6" :key="i">
            <el-upload drag action="https://jsonplaceholder.typicode.com/posts/" :multiple="false">
              <i class="el-icon-upload"></i>
              <div>
                <span style="font-size: 16px ;font-weight: 700;">正面照</span>
              </div>
              <div>点击/拖拽上传文件</div>
            </el-upload>
          </div>
        </div>
        <h4>x光照</h4>
        <div class="xPic">
          <div class="xPic-item" v-for="i in 2" :key="i">
            <el-upload drag action="https://jsonplaceholder.typicode.com/posts/" :multiple="false">
              <i class="el-icon-upload"></i>
              <div>
                <span style="font-size: 16px ;font-weight: 700;">正面照</span>
              </div>
              <div>点击/拖拽上传文件</div>
            </el-upload>
          </div>
        </div>
      </div>
      <div class="right_upload">
        <h4>批量上传</h4>
        <el-upload drag action="https://jsonplaceholder.typicode.com/posts/" multiple>
          <i class="el-icon-upload"></i>
          <div>
            <span style="font-size: 16px ;font-weight: 700;">正面照</span>
          </div>
          <div>将文件拖到此处，或<a>点击上传</a></div>
          <!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div> -->
        </el-upload>
        <ul>
          <li>批量上传单张图片不超过20M</li>
          <li>单张上传不限制大小</li>
          <li>支持JPG、PNG、BMP、WebP</li>

        </ul>
      </div>
    </div>
    <hr>
  </div>
</template>
<script>
export default {
  data() {
    return {
      ruleForm: {},
      rules: {
        name: [
          { required: true, message: "请输入患者姓名", trigger: "blur" },
          { min: 1, max: 5, message: "长度在 1 到 5 个汉字", trigger: "blur" },
        ],
        sex: [{ required: true, message: "请选择性别", trigger: "change" }],
        date: [
          {
            type: "date",
            required: true,
            message: "请选择日期",
            trigger: "change",
          },
        ],
        desc: [{ required: true, message: "请填写备注", trigger: "blur" }],
      },
    };
  },
  methods: {
    methods: {
      submitForm(formName) {
        console.log(this.formName, "-------37");
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert("submit!");
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      },
    },
  },
};
</script>
<style scoped>
.step1 {
  min-height: 400px;
}
.form {
  width: 50%;
  min-width: 300px;
}
.pics {
  display: flex;
  margin-bottom: 20px;
}
.left_pic {
  width: 1170px;
}
.right_upload {
  min-width: 270px;
  flex: 1;
  /* border: 1px solid red; */
  background-color: #ececec;
  margin: 6px 20px 20px;
  border-radius: 20px;
  text-align: center;
  padding: 20px;
}
.right_upload h4,
.right_upload ul {
  text-align: left;
}
.facePics {
  display: flex;
  justify-content: space-around;
  width: 1170px;
}
.facePics .facePic_item {
  border: 10px;
  height: 180px;
  width: 180px;
  text-align: center;
  border: 1px dashed #ccc;
}
.mouthPic {
  width: 888px;
  display: flex;
  box-sizing: border-box;
  justify-content: space-around;
  flex-wrap: wrap;
}
.mouthPic_item {
  margin: 0 27px 10px;
  text-align: center;
  border: 1px dashed #ccc;
  border-radius: 10px;
}
.xPic {
  display: flex;
  width: 100%;
}
.xPic-item {
  margin: 0 56px 10px;
  text-align: center;
  border: 1px dashed #ccc;
  border-radius: 10px;
}
</style>
<style>
.facePic_item .el-upload-dragger,
.mouthPic_item .el-upload-dragger,
.xPic-item .el-upload-dragger {
  height: 180px !important;
  width: 180px !important;
  text-align: center;
  border: 0;
  background-color: #fff;
}
</style>
